<template>
  <el-row :gutter="10" type="flex" class="equity-class-list" :class="{'black-bg':isBlack}">
    <el-col :span="colNum" v-for="(cit,i) in list" :key="i">
      <div class="equity-class-item">
        <div class="equity-class-item_title">
          <img :src="cit.icon" :alt="cit.name"><span>{{cit.name}}</span>
        </div>
        <div class="equity-list"  :class="{'white-scrollbar':!isBlack}">
          <div>
            <div class="equity-item" v-for="(it,i) in cit.right_list" :key="i">
              <img :src="it.p_icon" :alt="it.name">{{it.name.replace('\n', '')}}
            </div>
          </div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: 'EquityList',
  props: {
    data: {
      type: Array,
      default () {
        return []
      }
    },
    isBlack: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    list () {
      return this.data
    },
    colNum () {
      if (!this.list.length) return 24
      return 24 / this.list.length
    }
  }
}
</script>

<style lang="scss" scoped>
.equity-class{
  &-list{
    align-items: stretch;
    &.black-bg{
      .equity-class-item{
        color: #fff;
        background: rgba($color: #fff, $alpha: 0.03);
      }
    }
  }
  &-item{
    background: #f7f7f7;
    border-radius: 10px;
    padding: 17px 0 15px 0;
    height: 100%;
    &_title{
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: bold;
      img{
        flex: 0 0 20px;
        width: 20px;
        height: 20px;
        margin-right: 8px;
      }
    }
  }

}
.equity{
  &-list{
    display: flex;
    justify-content: center;
    margin-top: 15px;
    max-height: 192px;
    min-height: 90px;
    padding: 0 15px;
    overflow: auto;
  }
  &-item{
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 400;
    text-align: left;
    & +  & {
      margin-top: 12px;
    }
    img{
      flex: 0 0 22px;
      width: 22px;
      height: 22px;
      margin-right: 10px;
      border-radius: 4px;
      background: linear-gradient(180deg, #FFF2D2 0%, #F8DD99 100%);
    }
  }
}
</style>
